﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Management;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Computer
{
    public class ComputerHelper
    {
        public static string GetCPUID()
        {
            string cpuid = "";
            ManagementClass mc = new ManagementClass("Win32_Processor");
            ManagementObjectCollection moc = mc.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                cpuid = mo.Properties["ProcessorId"].Value.ToString();
            }
            return cpuid + ConfigurationManager.AppSettings["Num"].ToString();
            
        }
        /// 
        /// 获取IP地址
        /// 
        /// 
        public static string GetIPAddress()
        {
            System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;

            return addressList[0].ToString();
        }
    }
}
